package com.yidu.t299.dao.zzy;

import com.yidu.t299.domain.zzy.Class;
import com.yidu.t299.domain.zzy.Record;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author:周子怡
 * @Date:2023/03/21/9:11
 * @Description:
 */
@Mapper
public interface RecordaMapper {

    /**
     * 根据班级编号查询指定的信息
     * @param recordId 班级编号
     * @return 班级对象
     */
    @Select({
            "select " +
                    "record_id,record_name,record_age,record_sex," +
                    "record_phone,record_email,record_address," +
                    "record_id_card,dept_id,job_id" +
                    ",record_salary,record_school,school_id," +
                    "record_degree,agree_job_date,just_job_date,dimission_date",
            " from record",
            " where record_id = #{recordId,jdbcType=INTEGER}"
    })
    @Results({
            @Result(id = true,column = "record_id",property = "recordId"),
            @Result(column = "record_name",property = "recordName"),
            @Result(column = "record_age",property = "recordAge"),
            @Result(column = "record_sex",property = "recordSex"),
            @Result(column = "record_phone",property = "recordPhone"),
            @Result(column = "record_email",property = "recordEmail"),
            @Result(column = "record_address",property = "recordAddress"),
            @Result(column = "record_id_card",property = "recordIdCard"),
            @Result(column = "dept_id",property = "deptId"),
            @Result(column = "job_id",property = "jobId"),
            @Result(column = "record_salary",property = "recordSalary"),
            @Result(column = "record_school",property = "recordSchool"),
            @Result(column = "school_id",property = "schoolId"),
            @Result(column = "record_degree",property = "recordDegree"),
            @Result(column = "agree_job_date",property = "agreeJobDate"),
            @Result(column = "just_job_date",property = "justJobDate"),
            @Result(column = "dimission_date",property = "dimissionDate")
    })
    Record selectByPrimaryKey(Integer recordId);

    /**
     * 得到所有校区信息
     * @return 校区对象集合
     */
    @Select("select * from record")
    @Results({
            @Result(id = true,column = "record_id",property = "recordId"),
            @Result(column = "record_name",property = "recordName"),
            @Result(column = "record_age",property = "recordAge"),
            @Result(column = "record_sex",property = "recordSex"),
            @Result(column = "record_phone",property = "recordPhone"),
            @Result(column = "record_email",property = "recordEmail"),
            @Result(column = "record_address",property = "recordAddress"),
            @Result(column = "record_id_card",property = "recordIdCard"),
            @Result(column = "dept_id",property = "deptId"),
            @Result(column = "job_id",property = "jobId"),
            @Result(column = "record_salary",property = "recordSalary"),
            @Result(column = "record_school",property = "recordSchool"),
            @Result(column = "school_id",property = "schoolId"),
            @Result(column = "record_degree",property = "recordDegree"),
            @Result(column = "agree_job_date",property = "agreeJobDate"),
            @Result(column = "just_job_date",property = "justJobDate"),
            @Result(column = "dimission_date",property = "dimissionDate")
    })
    List<Record> selectAllGetRecord();

    /**
     * 根据学员名称查询学员编号
     * @param recordId 学员名称
     * @return 学员编号
     */
    @Select({
            "SELECT record_name" +
                    " FROM record" +
                    " WHERE record_id = #{recordId}"
    })
    Integer selectByName(Integer recordId);
}